<template>
  <div class="page-content">
    <el-card class="page-content-query" shadow="never">
      <template slot="header">
        <slot name="header" />
      </template>
      <template v-if="title || $slots.title">
        <slot name="title">
          <h3>{{ title }}</h3>
        </slot>
        <el-divider />
      </template>
      <el-scrollbar wrap-class="scrollbar-wrapper" view-class="scrollbar-view">
        <slot name="query" />
      </el-scrollbar>
    </el-card>
    <el-card v-if="$slots.default" class="page-content-body" shadow="never">
      <slot />
      <div class="table-pagination">
        <slot name="pagination" />
      </div>
      <template v-if="isFooter || $slots.footer">
        <el-divider />
        <slot name="footer">
          <div class="page-footer">
            <el-button @click="goBack">返回</el-button>
          </div>
        </slot>
      </template>
    </el-card>
  </div>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: ''
    },
    isFooter: Boolean
  },
  methods: {
    goBack() {
      this.$router.back()
    }
  }
}
</script>
<style lang="scss">
.page-content {
  height: 100%;
  width: 100%;
  .el-card__body {
    height: 100%;
    padding: 10px;
    .el-scrollbar {
      height: 100%;
      .scrollbar-wrapper {
        height: 100%;
        overflow-x: hidden;
        padding: 10px;
        box-sizing: border-box;
        .scrollbar-view {
          min-height: 100%;
          display: flex;
          flex-direction: column;
        }
      }
    }
  }
  .page-content-body {
    overflow: hidden;
    margin-top: 16px;
  }
  .page-footer {
    text-align: center;
  }
}
</style>
